package daliytool.http.server.response;

/**
 * 描述 新通教育
 *
 * @author ddshuai
 * @date 2018-10-26 09:04
 **/
public class ResultObject<T> {
    private String status = "1";
    private String msg;
    private T data;

    private ResultObject(T data) {
        this.data = data;
    }

    private ResultObject(String error) {
        this.msg = error;
        this.status = "0";
    }

    private ResultObject() {

    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public static <T> ResultObject<T> getInstance() {
        return new ResultObject<>();
    }

    public static <T> ResultObject<T> getInstance(T data) {
        return new ResultObject<>(data);
    }

    public static <T> ResultObject<T> generateError(String error) {
        return new ResultObject<>(error);
    }
}
